package bioAndNio.bio;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @Author: hmm
 * @Created: 2019/12/6
 * @Description:
 * @Modified by:
 */
public class BioServer {

    public static void main(String[] args) {
        try {
            byte[] bytes = new byte[1024];
            ServerSocket serverSocket = new ServerSocket(8090);
            while(true) {
                System.out.println("循环开始》》》》》》》》》》》");
                Socket accept = serverSocket.accept();
                System.out.println("接受请求》》》》》》》");
                int read = accept.getInputStream().read(bytes);
                Thread.sleep(3000);
                System.out.println("read" + read);
                System.out.println(new String(bytes));
            }
        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
        }

    }
}
